<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	//就是http://127.0.0.1:8080/pic/
	String basePath = "http://106.53.67.228/";
%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>目录页</title>
		<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/css/index.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/detail.css" type="text/css"/>
	</head>
	
	<body>
	<%--<div id="topOne">
		<div class="nav-link">
			<a class="act" href="${pageContext.request.contextPath}/index" >纵横中文网</a>&lt;%&ndash;<em>|</em>&ndash;%&gt;
			<div class="user">
				<font>
					<c:choose>
						<c:when test="${user ne null }">欢迎 ${user.username }&nbsp;&nbsp;|</c:when>
						<c:otherwise><a href="${pageContext.request.contextPath}/loginAndRegist.jsp">登录&nbsp;&nbsp;|</a></c:otherwise>
					</c:choose>
				</font>
				<font>
					<c:choose>
						<c:when test="${user ne null }"><a href="<c:url value="/user/logout"/>">退出</a></c:when>
						<c:otherwise><a href="${pageContext.request.contextPath}/loginAndRegist.jsp">注册</a></c:otherwise>
					</c:choose>
				</font>
			</div>
		</div>
	</div>
	<div id="Top">
		<div class="logo">
			<a href="${pageContext.request.contextPath}/index">
				<img src="${pageContext.request.contextPath}/static/images/timg.jpg" width="200px" height="50px" />
			</a>
		</div>
		<div class="search">
			<form id="search" action="<c:url value="/novel/findNovel" />" method="post">
				<div id="searchTxt" class="searchTxt">

					<div class="searchMenu">

						&lt;%&ndash;<div class="searchSelected" id="searchSelected">玄幻</div>
                        <div style="display:none;" class="searchTab" id="searchTab">&ndash;%&gt;
						<ul>
							<select  id="sel" name="novel.typeId" style="height:39px;border:0;padding:2px;margin:0;">
								<option value="">--请选择--</option>
								<c:forEach items="${noveltypeList }" var="noveltype">
									<option  style="background-color:transparent;"  value="${noveltype.id }">
											${noveltype.typename }
									</option>
								</c:forEach>
							</select>

						</ul>

					</div>
					<input name="novel.novelname" type="text" />
					<div class="searchBtn">
						<button id="searchBtn"></button>
					</div>
				</div>


		</div>

		</form>
	</div>--%>
	</div>
		<div class="box_con">
			<div id="listbook">
				<dl>

					<dt>《${novel.novelname}》作品章节</dt>
					<%--<div>
						<iframe src="<%=basePath%>${novel.texturl}" width="1000px" frameborder="0"  scrolling="yes" id="test" onload="this.height=5000">

						</iframe>
					</div>--%>
					<c:choose>
						<c:when test="${!empty chapterList }">
							<c:forEach items="${chapterList }" var="chapter" varStatus="num">
								<dd>
									<a href="<c:url value="/novel/read/${novel.id}?pc=${num.index+1}"/> " title="${chapter.chaptername}" target="_blank">${chapter.chaptername}</a>
								</dd>
							</c:forEach>
						</c:when>
						<c:otherwise>
							<div style="text-align: center;width:100%;">暂无章节</div>
						</c:otherwise>
					</c:choose>


					<dt>猜你可能喜欢相同的类型小说</dt>
                    <c:forEach items="${novelList }" var="novel">
                        <dd>
                            <a href="/NovelReading/novel/novelSearch?id=${novel.id}" title="${novel.novelname}" >${novel.novelname}</a>
                        </dd>
                    </c:forEach>


				</dl>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-3.4.1.min.js"></script>
	<script type="text/javascript">
	//内容宽度变化的iframe高度自适应
	function reinitIframe(){
		var iframe = document.getElementById("test");
		try{
		var bHeight = iframe.contentWindow.document.body.scrollHeight;
		var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
		var height = Math.max(bHeight, dHeight);
		iframe.height = height;
		//console.log(height);
		}catch (ex){}
	}
	/*window.setInterval("reinitIframe()", 200);*/
	</script>
</html>